﻿using CDude.Tools;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace CDude.Vita
{
    internal partial class OperationInProgressForm : Form
    {
        private Language language = null;

        public OperationInProgressForm(Language language)
        {
            this.language = language;
            InitializeComponent();
        }

        private void OperationInProgressForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
                e.Cancel = true;
        }

        private void OperationInProgressForm_Load(object sender, EventArgs e)
        {
            IntPtr menu = NativeMethods.GetSystemMenu(this.Handle, false);
            int menuitems = NativeMethods.GetMenuItemCount(menu) - 1;
            NativeMethods.RemoveMenu(menu, menuitems, 0x400);

            if (language != null)
                label.Text = language.Strings.OpInProgress;
        }

        private void OperationInProgressForm_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Owner != null)
                this.Location = new Point(this.Owner.Left + this.Owner.Size.Width / 2 - this.Size.Width / 2, this.Owner.Top + this.Owner.Size.Height / 2 - this.Size.Height / 2);
        }
    }
}